forum

home / developersection / forums / if statement inside repeater control

If statement inside Repeater control

Anonymous User 2424 02-Jun-2015

Although there are several questions on this topic, I haven't found any satisfactory answers.

I have a Repeater that needs to display complex content. An IF statement is required within the template. I can't move this to the code-behind as I need to have server controls and user controls registered within the repeater. Here is what I need:

<asp:Repeater ID="rCom" runat="server" ClientIDMode="Static">
    <ItemTemplate>
       <%# If CBool(Eval("IsFix")) Then%>
           <%-- HTML content including server and user controls --%>
       <%Else%>
           <%-- HTML content including server and user controls --%>
       <%End If%>
    </ItemTemplate>
</asp:Repeater>

The above throws a compiler error. Any idea on how to achieve this? I need to evaluate the IsFix field in the If statement.


Updated on 02-Jun-2015

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By